 <?php   
$day_now=array("Sun"=>"1","Mon"=>"2","Tue"=>"3","Wed"=>"4","Thu"=>"5","Fri"=>"6","Sat"=>"7");   
$first_day=date("D",mktime(0,0,1,intval(date("m")),1,date("Y")));   
$start_td=$day_now[$first_day]-1;      
$num_day=date("t");   
$num_day2=($num_day+$start_td);   
$num_day3=(7*ceil($num_day2/7));   
?>
   
<table id="calendar_css" width="200" border="0" cellspacing="0" cellpadding="0" style="border:2px solid #000 !important;">   
<colgroup>   
<col class="holidayCol" />   
<col span="5" />   
<col class="holidayCol" />   
</colgroup>   
<thead>   
<tr>
<td colspan="7" class="monthTitle">
<?=date("M d")?>
</td>
</tr>
  <tr>   
    <td valign="middle">Su </td>   
    <td valign="middle">M </td>   
    <td valign="middle">Tu </td>   
    <td valign="middle">W </td>   
    <td valign="middle">Th </td>   
    <td valign="middle">F </td>   
    <td valign="middle">Sa </td>   
  </tr>   
</thead>   
<?php for($i=1;$i <=$num_day3;$i++){ ?> 
<?php $style = ($i-$start_td>=1 && $i-$start_td <=$num_day)?NULL:'style="background-color:#e4e8f4;"'; ?>   
<?php if($i%7==1){ ?>  
 
  <tr>   
  <?php } ?>   
    <td <?=$style?>   valign="middle" <?=(date("j")==$i-$start_td)?"class=\"current\"":""?>> 
	<?=($i-$start_td>=1 && $i-$start_td <=$num_day)?$i-$start_td:" "?> 
    </td>   
<?php if($i%7==0){ ?>   
  </tr>   
  <?php } ?>   
<?php } ?>   
</table>  